<?php /* Smarty version Smarty-3.1.12, created on 2013-04-15 22:01:37
         compiled from "D:\wamp\www\acps_new\templates\tasks\add.tpl" */ ?>
<?php /*%%SmartyHeaderCode:1828850b002ac2d1956-84155914%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '30528cda8b8c80f07bb346de077baca6dc62d271' => 
    array (
      0 => 'D:\\wamp\\www\\acps_new\\templates\\tasks\\add.tpl',
      1 => 1366063283,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1828850b002ac2d1956-84155914',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.12',
  'unifunc' => 'content_50b002ac2d3b03_74000618',
  'variables' => 
  array (
    'data' => 0,
    'client' => 0,
    'responsible' => 0,
    'status' => 0,
    'type' => 0,
    'goods' => 0,
    'operation' => 0,
    'priority' => 0,
    'ptype' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_50b002ac2d3b03_74000618')) {function content_50b002ac2d3b03_74000618($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ($_smarty_tpl->tpl_vars['data']->value['pathToError'], $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<script type="text/javascript">
    
        
    function sendAction(action){
        $("#action").val(action);
        $("#adding").submit();    
    }
        
    function showOther(){
        var display = $("#otherTable").css("display");
        if (display == "none"){
            $("#other").empty();
            $("#other").append("- Other features of task");
            $("#otherTable").show();
            $("#showOther").val("1");
        } else {
            $("#other").empty();
            $("#other").append("+ Other features of task");
            $("#otherTable").hide();
            $("#showOther").val("0");
        }
    }
    
    function showTaskTypeTable(id){
        $("#taskType").removeClass("bgSpecial1");
        $(".external").hide();    
        if (id==8 || id==9){
            $("#taskType").addClass("bgSpecial1");
            $("#taskType"+id).show();
        }
    }
    
    function change_responsible(id){
        if (id!=""){
            $("#responsible option[value="+id+"]").attr("selected", "selected");
            $("#worker option[value="+id+"]").attr("selected", "selected");
        }
    }
        
    function change_worker(id){
        $("#worker option").removeAttr("selected");
        $("#worker option[value="+id+"]").attr("selected", "selected");
    }
        
    $(document).ready(function() {
        $("#created").datepicker({ 
            dateFormat: "dd/mm/yy",
            firstDay: 1      
        });
        $("#deadline").datepicker({ 
            dateFormat: "dd/mm/yy",
            firstDay: 1    
        });
        $("#date_of_action").datepicker({ 
            dateFormat: "dd/mm/yy" ,
            firstDay: 1     
        }); 
        $("#delivery").datepicker({ 
            dateFormat: "dd/mm/yy",
            firstDay: 1      
        });    
        $(".float").change(function() {
            makeFloat(".float",1);
        });
        change_responsible($('#client option:selected').attr("class"));
        $("#title").focus();
    });
    
</script>

<h2 class="pageTitle">Add task</h2>

<form class="adding" id="adding" action="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
?input=add_task" method="post" onsubmit="return checkAdd_task(
                                                                    $('#title').val(), 
                                                                    $('#client').val(),
                                                                    $('#responsible').val(),
                                                                    $('#deadline').val(), 
                                                                    $('#type').val(), 
                                                                    $('input:radio[name=task[status]]:checked').val(), 
                                                                    $('input:radio[name=task[priority]]:checked').val(), 
                                                                    'prazdno')">
    <table class="tableForm">
        <tr>
            <td>
                <label for="title">Title <span class="red">*</span> </label>
            </td>
            <td>
                <input name="task[title]" id="title" type="text" size="20" />
            </td>
            <td rowspan="6" class="top" style="width: auto; padding: 0; margin: 0;">
                <table class="">
                    <tr>
                        <td>
                            <label for="description">Description <span class="red"></span></label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <textarea cols="70" rows="6" name="task[description]" id="description"></textarea>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <label for="client">Client <span class="red">*</span> </label>
            </td>
            <td>
                <select name="task[client]" id="client" size="1" onchange="change_responsible($('#client option:selected').attr('class'))">
                    <option value="-1">Please select</option>
                    <?php  $_smarty_tpl->tpl_vars['client'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['client']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['clients']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['client']->key => $_smarty_tpl->tpl_vars['client']->value){
$_smarty_tpl->tpl_vars['client']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['client']->key;
?>
                        <option <?php if ($_SESSION['user']['user_type_id']!=@USER_TYPE_CLIENT&&$_smarty_tpl->tpl_vars['client']->value['bad_payer']==1){?>style="background: #ff545e"<?php }?> class="<?php echo $_smarty_tpl->tpl_vars['client']->value['contactPerson'];?>
" <?php if (isset($_SESSION['user']['clientFilter'])&&$_SESSION['user']['clientFilter']==$_smarty_tpl->tpl_vars['client']->value['klient_id']){?>selected="selected"<?php }elseif($_smarty_tpl->tpl_vars['client']->value['klient_id']==$_SESSION['user']['profile']['client']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['client']->value['klient_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['client']->value['name'];?>
</option>
                    <?php } ?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <label for="responsible">Responsible <span class="red">*</span> </label>
            </td>
            <td>
                <select name="task[responsible]" id="responsible" size="1" onchange="change_worker(this.value)">
                    <option value="-1">Please select</option>
                    <?php  $_smarty_tpl->tpl_vars['responsible'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['responsible']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['responsibles']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['responsible']->key => $_smarty_tpl->tpl_vars['responsible']->value){
$_smarty_tpl->tpl_vars['responsible']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['responsible']->key;
?>
                        <option value="<?php echo $_smarty_tpl->tpl_vars['responsible']->value['users_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['responsible']->value['surname'];?>
, <?php echo $_smarty_tpl->tpl_vars['responsible']->value['name'];?>
</option>
                    <?php } ?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <label for="worker">Worker</label>
            </td>
            <td>
                <select name="task[worker]" id="worker" size="1">
                    <option value="-1">Please select</option>
                    <?php  $_smarty_tpl->tpl_vars['responsible'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['responsible']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['responsibles']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['responsible']->key => $_smarty_tpl->tpl_vars['responsible']->value){
$_smarty_tpl->tpl_vars['responsible']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['responsible']->key;
?>
                        <option value="<?php echo $_smarty_tpl->tpl_vars['responsible']->value['users_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['responsible']->value['surname'];?>
, <?php echo $_smarty_tpl->tpl_vars['responsible']->value['name'];?>
</option>
                    <?php } ?>
                </select>
            </td>
        </tr>       
        <tr>
            <td>
                <label for="deadline">Deadline <span class="red">*</span> </label>
            </td>
            <td>
                <input name="task[deadline]" id="deadline" type="text" value="00/00/0000" />
            </td>
        </tr>
        <tr>
            <td><label for="duration">Expected amount</label></td>
            <td>
                <input class="float" name="task[duration]" id="duration" type="text" size="5" maxlength="5" />
            </td>
        </tr>
        <tr>
            <td colspan="3"><a style="color: black; text-decoration: none;" href="javascript: showOther()"><b id="other">+ Other features of task</b></a></td>
        </tr>
        <tr id="otherTable" class="bgGray">
            <td colspan="3">
                <table style="width: auto">
                    <tr>
                        <td>
                            <label for="status">Status <span class="red">*</span> </label>
                        </td>
                        <td>
                            <?php  $_smarty_tpl->tpl_vars['status'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['status']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['statuses']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['status']->key => $_smarty_tpl->tpl_vars['status']->value){
$_smarty_tpl->tpl_vars['status']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['status']->key;
?>
                                <input <?php if ($_smarty_tpl->tpl_vars['status']->value['id_stav']==1){?>checked="checked"<?php }?>name="task[status]" type="radio" value="<?php echo $_smarty_tpl->tpl_vars['status']->value['id_stav'];?>
" />&nbsp;<?php echo $_smarty_tpl->tpl_vars['status']->value['stav'];?>
<br/>
                            <?php } ?>
                        </td>
                        <td></td>
                    </tr>
                    <tr id="taskType">
                        <td>
                            <label for="type">Task type <span class="red">*</span> </label>
                        </td>
                        <td>
                            <select name="task[type]" id="type" size="1" onchange="showTaskTypeTable(this.value)">
                                <?php  $_smarty_tpl->tpl_vars['type'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['type']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['type']->key => $_smarty_tpl->tpl_vars['type']->value){
$_smarty_tpl->tpl_vars['type']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['type']->key;
?>
                                    <option <?php if ($_smarty_tpl->tpl_vars['type']->value['Id']==7){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['type']->value['Id'];?>
"><?php echo $_smarty_tpl->tpl_vars['type']->value['type_of_record'];?>
</option>
                                <?php } ?>
                            </select>
                        </td>
                        <td rowspan="5" id="external">
                            <table class="external bgSpecial1" id="taskType8">
                                <tr>
                                    <td>Expected date of delivery</td>
                                    <td><input name="goods[delivery]" type="text" id="delivery" /></td>
                                </tr>
                                <tr>
                                    <td>Real delivery time</td>
                                    <td><input name="goods[real]" type="text" /></td>
                                </tr>
                                <tr>
                                    <td>Type of goods</td>
                                    <td>
                                        <select name="goods[type_of_good]" size="1">
                                            <?php  $_smarty_tpl->tpl_vars['goods'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['goods']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['goods_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['goods']->key => $_smarty_tpl->tpl_vars['goods']->value){
$_smarty_tpl->tpl_vars['goods']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['goods']->key;
?>
                                                <option value="<?php echo $_smarty_tpl->tpl_vars['goods']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['goods']->value['type'];?>
</option>
                                            <?php } ?>
                                        </select> 
                                    </td>
                                </tr>
                            </table>
                            <table class="external bgSpecial1" id="taskType9">
                                <tr>
                                    <td>Operation</td>
                                    <td>
                                        <select name="operation[operation]" size="1">
                                            <option value="">Please select</option>
                                            <?php  $_smarty_tpl->tpl_vars['operation'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['operation']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['operation_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['operation']->key => $_smarty_tpl->tpl_vars['operation']->value){
$_smarty_tpl->tpl_vars['operation']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['operation']->key;
?>
                                                <option value="<?php echo $_smarty_tpl->tpl_vars['operation']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['operation']->value['operation'];?>
</option>
                                            <?php } ?>
                                        </select> 
                                    </td>
                                    <td>Date of operation</td>
                                    <td><input name="operation[date_of_action]" type="text" id="date_of_action" /></td>
                                </tr>
                                <tr>
                                    <td>Name</td>
                                    <td><input name="operation[name]" type="text" /></td>
                                    <td>Surname</td>
                                    <td><input name="operation[surname]" type="text" /></td>
                                </tr>
                                <tr>
                                    <td>Title</td>
                                    <td><input name="operation[title]" type="text" /></td>
                                    <td>External address</td>
                                    <td><input name="operation[address]" type="text" /></td>
                                </tr>
                                <tr>
                                    <td>Phone Number</td>
                                    <td><input name="operation[phone]" type="text" /></td>
                                    <td>Email</td>
                                    <td><input name="operation[email]" type="text" /></td>
                                </tr>
                                <tr>
                                    <td>Position</td>
                                    <td><input name="operation[position]" type="text" /></td>
                                    <td>Department</td>
                                    <td><input name="operation[department]" type="text" /></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="created">Task start <span class="red"></span> </label>
                        </td>
                        <td>
                            <input name="task[created]" id="created" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['start'];?>
" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="priority">Priority <span class="red">*</span> </label>
                        </td>
                        <td>
                            <?php  $_smarty_tpl->tpl_vars['priority'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['priority']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['priorities']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['priority']->key => $_smarty_tpl->tpl_vars['priority']->value){
$_smarty_tpl->tpl_vars['priority']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['priority']->key;
?>
                                <input <?php if ($_smarty_tpl->tpl_vars['priority']->value['id']==3){?>checked="checked"<?php }?>name="task[priority]" type="radio" value="<?php echo $_smarty_tpl->tpl_vars['priority']->value['id'];?>
" />&nbsp;<?php echo $_smarty_tpl->tpl_vars['priority']->value['Priorita'];?>
 - <?php echo $_smarty_tpl->tpl_vars['priority']->value['Popis'];?>
<br/>
                            <?php } ?>
                        </td>
                    </tr>
                    <tr>
                        <td><label for="problem_type">Type of problem</label></td>
                        <td>
                            <select name="task[problem_type]" id="problem_type" size="1" >
                                <option value="">Please select</option>
                                <?php  $_smarty_tpl->tpl_vars['ptype'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['ptype']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['problem_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['ptype']->key => $_smarty_tpl->tpl_vars['ptype']->value){
$_smarty_tpl->tpl_vars['ptype']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['ptype']->key;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['ptype']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['ptype']->value['problem'];?>
</option>
                                <?php } ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><label for="consult">Consult at a meeting</label></td>
                        <td>
                            <input name="task[consult]" id="consult" type="checkbox" value="1" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr class="submitRow">
            <td>
                <input name="action" value="addTask" type="hidden" id="action" />
                <span class="red">* Required</span>
            </td>
            <td colspan="2">
                <input type="button" value="Save" name="add_task" onclick="sendAction('addTask')" /> &nbsp; 
                <input type="button" value="Save & Send" name="add_task" onclick="sendAction('addTask_send')" /> &nbsp; 
                <input type="button" value="Save & Complete & Send" name="add_task" onclick="sendAction('addTask_complete_send')" /> &nbsp; 
                
            </td>
        </tr>
    </table>
</form><?php }} ?>